<?php

/**
 * Created by JetBrains PhpStorm.
 * User: GMC
 * Date: 10/3/13
 * Time: 2:20 PM
 * To change this template use File | Settings | File Templates.
 */
class WidgetUserInfo extends CWidget {
    public $user, $user_id;

    public function init() {
        $user = UserRaoVatInfo::model()->findByAttributes(array('user_id' => $this->user_id));
        $user_back = UserBack::model()->findByPk($this->user_id);
        if ($user == null) throw new CHttpException(999, 'Invalid request');
        $user->website = $user_back->website;
        $this->user = $user;
    }

    public function run() {
        return CWidget::render('widgetUserInfo', array('model' => $this->user));
    }
}